package zhuzg.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import zhuzg.feign.TestAService;

import javax.annotation.PostConstruct;

@RequestMapping("testb")
@RestController
public class TestbController {

    int cnt = 0;

    @Autowired
    TestAService testAService;


    @RequestMapping("strjoin")
    public String strJoing(@RequestParam("stra") String stra,@RequestParam("strb") String strb){
        cnt++;
       /* if(cnt>5){
            return  "调用次数过多";
        }*/
        return   testAService.strJoing(stra,strb);
    }


    @PostConstruct
    public void MyTimer(){

        Thread thread = new Thread() {
            @Override
            public void run() {
                while (true) {
                    cnt = 0;
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };

       // thread.start();
    }






}
